import WxRequest from '../assets/plugins/wx-request/lib/index'

class HttpService extends WxRequest {
  constructor(options) {
    super(options)
    this.$$prefix = ''
    this.$$path = {
      login: '/user/login',
      sellerCountry: '/seller/',
      carBrands: '/car/carBrands',
      factorys: '/carFactory/factorys',
      models: '/carModel/models',
      carHot: '/car/carHot',
      carArea: '/carArea/code',
      car: '/buyerCar/',
      banner: '/banner/seller',
      product: '/product/',
      multi: '/multi/',
      merchants: '/shop/',
      cart: '/cart/',
      integral: '/integral/',
      buyerUser: '/buyerUser/',
      order: '/order/',
      meal: '/meal/',
      pay: '/pay',
      instructions: '/carmaintain/maintain',
      saveUser: '/user/saveUser',
      notice: '/notice',
      coupons: '/coupons/',
      indexComments: '/shop',
      invoice: '/bill/',
      couponsList: '/user/coupons/status',
      verification: '/buyerUser/verification',
      sendCode: '/buyerUser/send',
      bindPhone: '/buyerUser/phone',
      feedBack: '/feedback/save',
      activity: '/activity/',
      check: '/user/check',
      heavyShop: '/heavy/buyer',
      saveHeavyId: '/user/saveHeavyId',
      fromid: '/sendFromId/saveFromId',
      dianziquan: 'user/electronicCoupons/status',
      yuding: 'shop/listTime',
      poster: '/poster',
      articleGroup: '/articleGroup',
      article: "/article",
      support: "/support",
      collection: "/collection",
      review: "/review",
      tousuType: "/tousuType",
      tousu: "tousu/save",
      author: "author/index",
      subscribe: "/subscribe",
      msg: "/msg/save",
      sensitive: "sensitive/check",
      user: "user/electronicCoupons/",
      readeds: "/readed",
      shibiet: "/vehicleLicense",
      kg: "/user/swit",
      qingqf: "/inviteactivity",
      lieb: "/getFriends",
      duih: "/couponscode/",
      diukeh: "lottery/exist",
      hhxy: "buyerVip/vipInfo",
      cccc:"/lottery",
      xiaoxis:"msg/info",
      dddd:"msg/msgList",
      gsf:"meal/getHostFee" ,
      wdjp:"prize/list",
      swlq:"prize/drawPrize",
      cfb:"/inviteactivity/",
      sssss:"/vehicleLicense/index",
      zzz:"/multi"
    }


    this.interceptors.use({
      request(request) {
        request.header = request.header || {}
        request.header['content-type'] = 'application/json'
        if (request.url.indexOf('/api') !== -1 && wx.getStorageSync('token')) {
          request.header.Authorization = 'Bearer ' + wx.getStorageSync('token')
        }
     
        return request
      },
      requestError(requestError) {
        // wx.hideLoading()
        wx.showToast({
          title: '服务器错误',
          image: '../assets/images/warning.png',
          duration: 1500
        })
        return Promise.reject(requestError)
      },
      response(response) {
   
        return response
      },
      responseError(responseError) {
        wx.hideLoading()
        return Promise.reject(responseError)
      },
    })
  }

  login(params) { // 登陆平台
    return this.postRequest(this.$$path.login, {
      data: params
    })
  }


  // 开团
  kaituan(params) {
    return this.postRequest(this.$$path.multi + 'placeMulti', {
      data: params
    })


  }

  sellerCountry(params) { // 获取代理商地区
    return this.postRequest(this.$$path.sellerCountry + 'country', {
      data: params
    })
  }
  sellerCity(params) { // 获取开通城市
    return this.postRequest(this.$$path.sellerCountry + 'city')
  }
  carBrands(params) { // 汽车品牌 一级菜单
    return this.postRequest(this.$$path.carBrands, {
      data: params
    })
  }
  getSecond(params) { // 汽车车系 二级菜单
    return this.postRequest(this.$$path.factorys, {
      data: params
    })
  }
  getThird(params) { // 汽车车系 三级菜单
    return this.postRequest(this.$$path.models, {
      data: params
    })
  }
  getCarHot(params) { // 热门车型
    return this.postRequest(this.$$path.carHot, {
      data: params
    })
  }
  getCarCode() { // 获取车牌号第一个字
    return this.postRequest(this.$$path.carArea)
  }
  carSave(params) { // 保存车辆信息
    return this.postRequest(this.$$path.car + 'save', {
      data: params
    })
  }
  //  在消息模板中获取优惠券
  ling(params) {
    return this.postRequest(this.$$path.coupons + 'oneSave', {
      data: params
    })
  }

  userCars(params) { // 车辆列表
    return this.postRequest(this.$$path.car + 'userCars', {
      data: params
    })
  }
  // 修改汽车里程
  updateMileage(params) {
    return this.postRequest(this.$$path.car + 'mileage', {
      data: params
    });
  }
  carDetail(params) { // 车辆详情
    return this.postRequest(this.$$path.car + 'car', {
      data: params
    })
  }
  carDefault(params) { // 设置默认车辆
    return this.postRequest(this.$$path.car + 'updateDefault', {
      data: params
    })
  }
  carDel(params) { // 删除车辆
    return this.postRequest(this.$$path.car + 'delete', {
      data: params
    })
  }
  getDefault(params) { // 获取默认车辆
    return this.postRequest(this.$$path.car + 'carDefault', {
      data: params
    })
  }
  getBanner(params) { // 获取轮播图
    return this.postRequest(this.$$path.banner, {
      data: params
    })
  }
  fid(params) { //发送到fid到后台
    return this.postRequest(this.$$path.fromid, {
      data: params
    })
  }
  // 获取电子优惠券
  dzq(params) {
    return this.postRequest(this.$$path.dianziquan, {
      data: params
    })
    // 666
  }
  // 时间段预约yuding
  yy(params) {
    return this.postRequest(this.$$path.yuding, {
      data: params
    })
  }



  getPproduct(params) { // 获取商品列表
    return this.postRequest(this.$$path.product + 'listInfo', {
      data: params
    })
  }
  erweima(params) { // 获取e二维码
    return this.postRequest(this.$$path.multi + 'getQrCode', {
      data: params
    })
  }

  getMulti(params) { // 获取拼团列表
    return this.postRequest(this.$$path.multi + 'info', {
      data: params
    })
  }

  multiOrderSave(params) { // 拼团下单
    return this.postRequest(this.$$path.multi + 'place', {
      data: params
    })
  }
  getMerchants(params) { // 获取商家列表
    return this.postRequest(this.$$path.merchants + 'seller', {
      data: params
    })
  }

  // 特殊优惠券的商家列表
  getMerchantss(params) { // 获取商家列表
    return this.postRequest(this.$$path.merchants + 'servicesShopList', {
      data: params
    })
  }



  getProDetail(params) { // 获取商品详情
    return this.postRequest(this.$$path.product + 'detail', {
      data: params
    })
  }
  getMuDetail(params) { // 获取拼团商品详情
    return this.postRequest(this.$$path.multi + 'detail', {
      data: params
    })
  }
  cartAdd(params) { // 添加购物车
    return this.postRequest(this.$$path.cart + 'add', {
      data: params
    })
  }
  cartEdit(params) { // 编辑购物车
    return this.postRequest(this.$$path.cart + 'quantity', {
      data: params
    })
  }
  cartDel(params) { // 删除购物车
    return this.postRequest(this.$$path.cart + 'delete', {
      data: params
    })
  }
  cartList(params) { // 购物车列表
    return this.postRequest(this.$$path.cart + 'list', {
      data: params
    })

  }
  // 积分商品类别
  integralType(params) {
    return this.postRequest(this.$$path.integral + 'types', {
      data: params
    });
  }
  intList(params) { // 积分商品列表
    return this.postRequest(this.$$path.integral + 'list', {
      data: params
    })
  }
  intDtail(params) { // 积分商品详情
    return this.postRequest(this.$$path.integral + 'detail', {
      data: params
    })
  }
  intBill(params) { // 积分流水
    return this.postRequest(this.$$path.integral + 'buyer', {
      data: params
    })
  }
  intSave(params) { // 积分下单
    return this.postRequest(this.$$path.integral + 'change/save', {
      data: params
    })
  }
  userInfo(params) { // 获取用户信息
    return this.postRequest(this.$$path.buyerUser + 'info', {
      data: params
    })
  }
  intOrder(params) { // 积分订单列表
    return this.postRequest(this.$$path.order + 'integral/list', {
      data: params
    })
  }
  //  电子券使用请求接口
  dianziquanshiy(params) { // 积分订单列表
    return this.postRequest(this.$$path.order + 'electronicCreate', {
      data: params
    })
  }



  intOrderDel(params) { // 删除积分订单列表
    return this.postRequest(this.$$path.order + 'integral/delete', {
      data: params
    })
  }
  intOrderDetail(params) { // 积分订单详情
    return this.postRequest(this.$$path.order + 'integral/detail', {
      data: params
    })
  }
  discount(params) { // 获取用户优惠活动
    return this.postRequest(this.$$path.buyerUser + 'discount', {
      data: params
    })
  }
  proOrderSave(params) { // 普通商品下单
    return this.postRequest(this.$$path.order + 'place', {
      data: params
    })
  }
  prodOrderList(params) { // 普通商品订单列表
    return this.postRequest(this.$$path.order + 'prodList', {
      data: params
    })
  }
  // 订单信息
  orderInfo(params) {
    return this.postRequest(this.$$path.order + 'info', {
      data: params
    });
  }
  prodOrderDetail(params) { // 普通商品订单详情
    return this.postRequest(this.$$path.order + 'detail', {
      data: params
    })
  }
  multOrderList(params) { // 拼团商品订单列表
    return this.postRequest(this.$$path.order + 'multiList', {
      data: params
    })
  }
  mealInfo(params) { // 获取套餐详情
    return this.postRequest(this.$$path.meal + 'info', {
      data: params
    })
  }
  mealDetail(params) { // 首页获取套餐详情


    return this.postRequest(this.$$path.meal + 'detail', {
      data: params
    })
  }
  pay(params) { // 支付
    return this.postRequest(this.$$path.pay, {
      data: params
    })
  }
  refund(params) { // 退款
    return this.postRequest(this.$$path.pay + '/refund', {
      data: params
    })
  }
  // 申请退款
  tuikuan(params) {
    return this.postRequest(this.$$path.order + 'orderRefund', {
      data: params
    })
  }
  saveUser(params) { // 保存用户信息


    return this.postRequest(this.$$path.saveUser, {
      data: params
    
    })
  }
  instructions(params) { // 保养手册
    return this.postRequest(this.$$path.instructions, {
      data: params
    })
  }
  notice(params) { // 公告
    return this.postRequest(this.$$path.notice, {
      data: params
    })
  }

  //测试假得数据

   ceshisss(params) {
     return this.postRequest(this.$$path.sssss, {
       data: params
     })
   }



  // 公告列表
  noticeList(params) {
    return this.postRequest(this.$$path.notice + '/list', {
      data: params
    });
  }
  // 公告详情页
  noticeDetail(params) {
    return this.postRequest(this.$$path.notice + '/detail', {
      data: params
    });
  }
  search(params) { // 搜索商家
    return this.postRequest(this.$$path.merchants + 'shops', {
      data: params
    })
  }
  shopDetail(params) { // 商家详情
    return this.postRequest(this.$$path.merchants + 'detail', {
      data: params
    })
  }
  // 洗车商家详情
  washShopDetail(params) {
    return this.postRequest(this.$$path.merchants + 'cleanShopDetail', {
      data: params
    });
  }
  // 加盟商家
  joinMerchant(params) {
    return this.postRequest(this.$$path.merchants + 'apply/save', {
      data: params
    });
  }
  shopRevies(params) { // 商家评价
    return this.postRequest(this.$$path.merchants + 'revies', {
      data: params
    })
  }
  // 评价详情
  reviesDetail(params) {
    return this.postRequest(this.$$path.merchants + 'revies/detail', {
      data: params
    });
  }
  // 获取评价
  getComments(params) {
    return this.postRequest(this.$$path.merchants + 'list', {
      data: params
    })
  }
  userRevies(params) { // 发表评价
    return this.postRequest(this.$$path.merchants + 'revies/save', {
      data: params
    })
  }

  // 用户提交意见或建议
  saveFeedBack(params) {
    return this.postRequest(this.$$path.feedBack, {
      data: params
    })
  }
  // 获取首页优惠券
  couponsList(params) {
    return this.postRequest(this.$$path.coupons + 'list', {
      data: params
    })
  }
  // 领取优惠券
  receiveCoupons(params) {
    return this.postRequest(this.$$path.coupons + 'save', {
      data: params
    });
  }
  // 获取订单页优惠券
  getCoupons(params) {
    return this.postRequest(this.$$path.coupons + 'user', {
      data: params
    });
  }
  // 获取个人中优惠券列表
  couponsLists(params) {
    return this.postRequest(this.$$path.couponsList, {
      data: params
    });
  }
  // 首页评价
  indexComments(params) {
    return this.postRequest(this.$$path.indexComments, {
      data: params
    });
  }
  // 洗车列表
  washCarList(params) {
    return this.postRequest(this.$$path.merchants + 'cleanShops', {
      data: params
    });
  }
  // 增加发票 
  addInvoice(params) {
    return this.postRequest(this.$$path.invoice + 'saveOrupdate', {
      data: params
    });
  }
  // 获取发票详情
  invoiceDetail(params) {
    return this.postRequest(this.$$path.invoice + 'detail', {
      data: params
    });
  }
  // 验证用户信息是否完整
  verification(params) {
    return this.postRequest(this.$$path.verification, {
      data: params
    });
  }
  // 发送手机验证码
  sendCode(params) {
    return this.postRequest(this.$$path.sendCode, {
      data: params
    });
  }
  // 绑定手机号
  bindPhone(params) {
    return this.postRequest(this.$$path.bindPhone, {
      data: params
    });
  }
  // 获取活动
  getActivity(params) {
    return this.postRequest(this.$$path.activity + 'list', {
      data: params
    });
  }
  // 获取活动详情
  getActivityDetail(params) {
    return this.postRequest(this.$$path.activity + 'detail', {
      data: params
    });
  }
  //核实用户信息
  checkUserInfo(params) {
    return this.postRequest(this.$$path.check, {
      data: params
    });
  }
  //根据大客户ID获取
  heavyShop(params) {
    return this.postRequest(this.$$path.heavyShop, {
      data: params
    });
  }
  //保存用户大客户ID
  saveHeavyId(params) {
    return this.postRequest(this.$$path.saveHeavyId, {
      data: params
    });
  }

  dandu(params) {
    return this.postRequest(this.$$path.multi + 'single', {
      data: params
    });


  }
  ditu() {
    return this.postRequest(this.$$path.poster + '/list', {});
  }

  // 资讯页nev
  zixunnav(params) {
    return this.postRequest(this.$$path.articleGroup + "/listGroup", {
      data: params
    })

  }

  // 资讯页请求

  zixunqq(params) {
    return this.postRequest(this.$$path.article + "/listPage", {
      data: params
    })
  }

  // 咨询详情
  zzxq(params) {
    return this.postRequest(this.$$path.article + "/getById", {
      data: params
    })
  }

  // 文章视频点赞
  dianz(params) {
    return this.postRequest(this.$$path.support, {
      data: params
    })
  }


  // 文章视频收藏
  wzsc(params) {
    return this.postRequest(this.$$path.collection, {
      data: params
    })
  }
  // 文章视频评论
  qqpl(params) {
    return this.postRequest(this.$$path.review + "/listPage", {
      data: params
    })

  }
  // 文章视频评论回复
  qqplhf(params) {
    return this.postRequest(this.$$path.review + "/list", {
      data: params
    })
  }

  // 文章评论点赞
  pldz(params) {
    return this.postRequest(this.$$path.support + "/review", {
      data: params
    })
  }


  // 举报信息
  jbxx(params) {
    return this.postRequest(this.$$path.tousuType + "/list", {
      data: params
    })
  }
  // 举报

  tousu(params) {
    return this.postRequest(this.$$path.tousu, {
      data: params
    })

  }
  // 查看我的收藏
  shoucand(params) {
    return this.postRequest(this.$$path.collection + "/list", {
      data: params
    })
  }

  // 评论
  pingluns(params) {
    return this.postRequest(this.$$path.review + "/save", {
      data: params
    })
  }
  // 作者信息
  zuozhe(params) {
    return this.postRequest(this.$$path.author, {
      data: params
    })
  }
  // 订阅
  dingyue(params) {
    return this.postRequest(this.$$path.subscribe, {
      data: params
    })
  }

  // 留言


  liuyans(params) {
    return this.postRequest(this.$$path.msg, {
      data: params
    })
  }

  // 检测敏感词语
  jiancem(params) {
    return this.postRequest(this.$$path.sensitive, {
      data: params
    })
  }

  // 洗车电子券
  xichedianziq(params) {
    return this.postRequest(this.$$path.user + "setOrder", {
      data: params
    })
  }
  //
  // 电子券单独支付
  dianziqfus(params) {
    return this.postRequest(this.$$path.user + "place", {
      data: params
    })
  }

  // 车主必读 保养页面的
  readed(params) {
    return this.postRequest(this.$$path.readeds, {
      data: params
    })
  }

  //搜索资讯

  sszx(params) {
    return this.postRequest(this.$$path.article + "/search", {
      data: params
    })
  }

  // 识别行驶证
  shibiexing(params) {
    return this.postRequest(this.$$path.shibiet, {
      data: params
    })
  }

  //手机号返回
  shibshouj(params) {
    return this.postRequest(this.$$path.check, {
      data: params
    })

  }
  //k开关
  kaiguan() {
    return this.postRequest(this.$$path.kg, {})

  }


  //请求有无活动
  youwuhud(params) {
    return this.postRequest(this.$$path.qingqf, {
      data: params
    })

  }
  //转发成功触发
  qqkiuk(params) {
    return this.postRequest(this.$$path.qingqf + "/wantInvite", {
      data: params
    })
  }
  // 请求列表邀请人
  fxlb(params) {
    return this.postRequest(this.$$path.lieb, {
      data: params
    })
  }

  // 请求账户余额、
  zhyes(params) {
    return this.postRequest(this.$$path.buyerUser + "userMoney", {
      data: params
    })

  }
  // 请求佣金记录


  yjjl(params) {
    return this.postRequest(this.$$path.buyerUser + "moneyInfo", {
      data: params
    })
  }
  // 请求提现100元


  qqtx(params) {
    return this.postRequest(this.$$path.buyerUser + "withdrawal", {
      data: params
    })
  }

  // 激活优惠券、
  jhyhq(params) {
    return this.postRequest(this.$$path.coupons + "activation", {
      data: params
    })
  }
  // 兑换码

  duihuan(params) {
    return this.postRequest(this.$$path.duih + "index", {
      data: params
    })
  }

  //请求悬浮窗
  qqxfc(params) {
    return this.postRequest(this.$$path.diukeh, {
      data: params
    })
  }
  //请求会员信息
  // buyerVip/vipInfo 
  huiyxx(params) {
    return this.postRequest(this.$$path.hhxy, {
      data: params
    })

  }

  //请求富文本
  qiingqiufuqwnb(params) {
    return this.postRequest(this.$$path.qingqf + "/getIntviteeText", {
      data: params
    })
  }
  
  // 请求抽奖数据、
  // lottery / draw

  qingqjp(params){
    return this.postRequest(this.$$path.cccc + "/draw", {
      data: params
    })

  }
  choujyw(params){
    return this.postRequest(this.$$path.cccc + "/settleDraw", {
      data: params
    })

  }
  //请求有没有机会抽奖
  youwuchouj(params){
   
    return this.postRequest(this.$$path.cccc + "/orderExist", {
      data: params
    })
  }


  //请求有没有机会抽奖
  qingqiuhud(params) {
    return this.postRequest(this.$$path.qingqf + "/inviteExist", {
      data: params
    })
  }

// 请求聊天消息列表
  qingqiuliaotlieb(params) {
    return this.postRequest(this.$$path.xiaoxis, {
      data: params
    })
  }
  // 请求聊天信息
  
  liaotianjl(params) {
    return this.postRequest(this.$$path.dddd, {
      data: params
    })
  }
  // 查询工时费
  gongshifei(params){
    return this.postRequest(this.$$path.gsf, {
      data: params
    })

  }
// 请求我的奖品
  

  jiangp(params) {
    return this.postRequest(this.$$path.wdjp, {
      data: params
    })

  }
  // 实物领取
  lingjingqingqiu(params) {
    return this.postRequest(this.$$path.swlq, {
      data: params
    })
  }
//财富榜
  
  caifub(params) {
    return this.postRequest(this.$$path.cfb +"listTreasure", {
      data: params
    })
  }

  wdyqs(params) {
    return this.postRequest(this.$$path.cfb + "getInviteBuyer", {
      data: params
    })
  }

  fuwenbenqingq(params) {
    return this.postRequest(this.$$path.cfb + "getRule", {
      data: params
    })
  }

  // 团购未支付的支付接口


  zzzf(params){
    return this.postRequest(this.$$path.zzz + "/multiPay", {
      data: params
    })

  }


}

export default HttpService